package com.eastfair.matching.controller;

import com.eastfair.core.base.R;
import com.eastfair.messagecenter.api.MsgServiceFeign;
import com.eastfair.messagecenter.dto.InnerSendDTO;
import io.swagger.annotations.Api;
import lombok.extern.slf4j.Slf4j;
import org.springframework.scheduling.concurrent.ThreadPoolTaskExecutor;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;

/**
 * <p>
 * 前端控制器
 * 消息
 * </p>
 *
 * @author ln
 * @date 2022-10-24
 */
@Slf4j
@Validated
@RestController
@RequestMapping("/msg")
@Api(value = "msg", tags = "消息")
public class MatchingMsgController {

    @Resource
    private MsgServiceFeign msgServiceFeign;

    @Resource(name = "threadPoolTaskExecutor")
    private ThreadPoolTaskExecutor threadPoolTaskExecutor;

    @PostMapping({"/sendInnerInMsg"})
    public R sendInnerInMsg(@RequestBody InnerSendDTO var1){
        threadPoolTaskExecutor.execute(()->{msgServiceFeign.sendInnerInMsg(var1);});
        return R.success();
    };

}
